<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    console.log(Math.PI)
    console.log(Math.ceil(1.1)) //向上

    console.log(Math.max(1, 2, 3, 4))  //最大
    console.log(Math.min(1, 2, 3, 4))  //最小
    console.log(Math.pow(2, 3))  //幂 (2,3) === 2*2*2
    console.log(Math.abs(-10))  //绝对值
    console.log('--------------')
    //四舍五入
    console.log(Math.round(1.49))
    console.log(Math.round(1.5))
    console.log(Math.round(-1.1))
    console.log(Math.round(-1.5))
    console.log(Math.round(-1.51))
    console.log(Math.round(-2.5))
    console.log(Math.round(-2.6))
    console.log('---------------')
    // 区别:取整函数parseInt(与Math.floor()
    console.log(Math.floor(3.9))  //向下取整
    console.log(parseInt(1.2))  //1

    console.log(Math.floor('12px')) //NaN 括号里面只能是数字型
    console.log(parseInt('12px'))  //12 本来就是默认转换字符串为数字型

  </script>
</body>

</html>